package com.coolbi.onsupai.core.biz.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.coolbi.onsupai.core.biz.TransportModeBiz;
import com.coolbi.onsupai.core.dao.TransportModeDao;
import com.coolbi.onsupai.core.entity.TransportMode;
import com.coolbi.onsupai.core.exception.ServiceException;

public class TransportModeBizImpl implements TransportModeBiz {

	@Autowired
	private TransportModeDao transportModeDao;
	
	@Override
	public TransportMode save(TransportMode obj) {
		try {
			transportModeDao.save(obj);
		} catch (Exception e) {
			throw new ServiceException("添加运输方式发生错误！", e);
		}
		return obj;
	}

	@Override
	public void delete(long id) {
		try {
			transportModeDao.delete(id);
		} catch (Exception e) {
			throw new ServiceException("删除运输方式发生错误！", e);
		}
	}

	@Override
	public void update(TransportMode obj) {
		try {
			transportModeDao.update(obj);
		} catch (Exception e) {
			throw new ServiceException("修改运输方式发生错误！", e);
		}
	}

	@Override
	public TransportMode get(long id) {
		return transportModeDao.get(id);
	}

	@Override
	public List<TransportMode> list() {
		return transportModeDao.list();
	}

	@Override
	public List<TransportMode> listByPage(int offset, int limit) {
		return transportModeDao.listByPage(offset, limit);
	}

	@Override
	public List<TransportMode> find(Map<String, Object> parameter) {
		return transportModeDao.find(parameter);
	}

	@Override
	public List<TransportMode> findByPage(Map<String, Object> parameter,
			int offset, int limit) {
		return transportModeDao.findByPage(parameter, offset, limit);
	}

	@Override
	public List<TransportMode> search(Map<String, Object> parameter,
			int offset, int limit) {
		return transportModeDao.search(parameter, offset, limit);
	}

	@Override
	public int count() {
		return transportModeDao.count();
	}

	@Override
	public int countByKeyWord(Map<String, Object> parameter) {
		return transportModeDao.countByKeyWord(parameter);
	}

	@Override
	public int count(Map<String, Object> parameter) {
		return transportModeDao.count(parameter);
	}

	public void setTransportModeDao(TransportModeDao transportModeDao) {
		this.transportModeDao = transportModeDao;
	}

}
